//
//  KAApplySectionFooter.swift
//  kano
//
//  Created by Sophia on 2024/8/22.
//

import UIKit
import ActiveLabel

class KAApplySectionFooter: UITableViewHeaderFooterView {

    lazy var titleLabel: ActiveLabel = {
        titleLabel = ActiveLabel()
        let customType = ActiveType.custom(pattern: "\\*565\\*0#")
        titleLabel.enabledTypes = [customType]
        titleLabel.numberOfLines = 0
        titleLabel.text = "You don't know your BVN（11 digit number）?dial *565*0# \nPlease fill in your correct BVN,ensure that the BVN belongs to the name provided above otherwise your loan may not be approved"
        titleLabel.lineSpacing = kscale(8)
        titleLabel.font = kFontSize(11)
        titleLabel.customColor[customType] = .black
        titleLabel.textColor = .color8A8891
        titleLabel.handleCustomTap(for: customType, handler: { (customType) in
            if let url = URL(string: "telprompt://*565*0#") {
                UIApplication.shared.open(url, options: [:], completionHandler: nil)
            }
        })
        titleLabel.frame = CGRectMake(kscale(20), kscale(10), var_screenWidth-kscale(40), kscale(60))
        return titleLabel
    }()
    
    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier)
        contentView.backgroundColor = .white
        createUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func createUI() {
        contentView.addSubview(titleLabel)
//        titleLabel.snp.makeConstraints { make in
//            make.top.equalTo(contentView).offset(kscale(10));
//            make.bottom.equalTo(contentView).offset(kscale(-10));
//            make.left.equalTo(contentView).offset(kscale(20));
//            make.right.equalTo(contentView).offset(kscale(-20));
//        }
    }
}
